<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="./WEB-INF/googlemaps.tld" prefix="googlemaps" %>
<googlemaps:map id="map" width="650" height="400" version="2.46" type="STREET" zoom="2">
 	<googlemaps:key domain="http://localhost" key="ABQIAAAAfnthxKxK7MSOAAqStb8Y5BTwM0brOpm-All5BF6PoaKBxRWWERTxNu4lVGKp98JuZGOL24P2S8nAlw"/>
 	<googlemaps:point id="point1" latitude="${latitude}" longitude="${longitude}"/>
 	<googlemaps:marker id="marker1" point="point1" />
	<googlemaps:zoomControl enable="true" size="small"/>
 	<googlemaps:coordinates x="530" y="0" style="font-family:verdana; font-size: 10px; background: #ffffff; border: dashed 1px #000000; padding: 2 0 2 5; opacity: 0.70; filter: alpha(opacity=70);"/>
</googlemaps:map>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Edit Pub</title>
</head>
<body onunload="GUnload()">

<googlemaps:scripttag id="map" scope="page" /> 
<googlemaps:javascript id="map" scope="page"/>

<%
if(session.getAttribute("username") != null && session.getAttribute("username") != "") {
%>

<a href="logout.jsp">Logout</a>

<h1>Edit Pub</h1>
<div><a href="http://localhost:8080/Pub2SearchAdmin/browse.jsp">Back to the List</a>
&nbsp;<div style="color:green">${dbmessage}</div></div>

<form name="updateform" action="updatepub" method="post">
<table>
<tr>
	<td colspan="2">
	<googlemaps:div id="map"/> 
	<googlemaps:initialize id="map"/>
	</td>
</tr>
<tr>
	<td>Coordinate:</td>
	<td><input name="txt_latitude" value="${latitude}" size="19" maxlength="9" /><input name="txt_longitude" value="${longitude}" size="19" maxlength="9" /></td>
</tr>
<tr>
	<td>Name:</td><td><input name="txt_name" value="${name}" size="40" /></td>		
</tr>
<tr>
	<td>Address:</td><td><input name="txt_address" value="${address}" size="40" /></td>
</tr>
<tr>
	<td>Open Hour:</td>
	<td>
	<select name="txt_openhour">	
		<option value="0" ${open_hour_24}>00</option>
		<option value="1" ${open_hour_01}>01</option>
		<option value="2" ${open_hour_02}>02</option>
		<option value="3" ${open_hour_03}>03</option>
		<option value="4" ${open_hour_04}>04</option>
		<option value="5" ${open_hour_05}>05</option>
		<option value="6" ${open_hour_06}>06</option>
		<option value="7" ${open_hour_07}>07</option>
		<option value="8" ${open_hour_08}>08</option>
		<option value="9" ${open_hour_09}>09</option>
		<option value="10" ${open_hour_10}>10</option>
		<option value="11" ${open_hour_11}>11</option>
		<option value="12" ${open_hour_12}>12</option>
		<option value="13" ${open_hour_13}>13</option>
		<option value="14" ${open_hour_14}>14</option>
		<option value="15" ${open_hour_15}>15</option>
		<option value="16" ${open_hour_16}>16</option>
		<option value="17" ${open_hour_17}>17</option>
		<option value="18" ${open_hour_18}>18</option>
		<option value="19" ${open_hour_19}>19</option>
		<option value="20" ${open_hour_20}>20</option>
		<option value="21" ${open_hour_21}>21</option>
		<option value="22" ${open_hour_22}>22</option>
		<option value="23" ${open_hour_23}>23</option>
	</select>&nbsp;:&nbsp;
	<select name="txt_openminute">	
		<option value="0" ${open_minute_00}>00</option>
		<option value="30" ${open_minute_30}>30</option>
	</select></td>
</tr>
<tr>
	<td>Close Hour:</td>
	<td><select name="txt_closehour">	
		<option value="24" ${close_hour_24}>00</option>
		<option value="1" ${close_hour_01}>01</option>
		<option value="2" ${close_hour_02}>02</option>
		<option value="3" ${close_hour_03}>03</option>
		<option value="4" ${close_hour_04}>04</option>
		<option value="5" ${close_hour_05}>05</option>
		<option value="6" ${close_hour_06}>06</option>
		<option value="7" ${close_hour_07}>07</option>
		<option value="8" ${close_hour_08}>08</option>
		<option value="9" ${close_hour_09}>09</option>
		<option value="10" ${close_hour_10}>10</option>
		<option value="11" ${close_hour_11}>11</option>
		<option value="12" ${close_hour_12}>12</option>
		<option value="13" ${close_hour_13}>13</option>
		<option value="14" ${close_hour_14}>14</option>
		<option value="15" ${close_hour_15}>15</option>
		<option value="16" ${close_hour_16}>16</option>
		<option value="17" ${close_hour_17}>17</option>
		<option value="18" ${close_hour_18}>18</option>
		<option value="19" ${close_hour_19}>19</option>
		<option value="20" ${close_hour_20}>20</option>
		<option value="21" ${close_hour_21}>21</option>
		<option value="22" ${close_hour_22}>22</option>
		<option value="23" ${close_hour_23}>23</option>
	</select>&nbsp;:&nbsp;
	<select name="txt_closeminute">	
		<option value="0" ${close_minute_00}>00</option>
		<option value="30" ${close_minute_30}>30</option>
	</select></td>
</tr>
<tr>
	<td>Description:</td><td><textarea rows="5" cols="40" name="txt_description" >${description}</textarea></td>
</tr>
<tr>
    <td>Facility:</td>
    <td>
    <input type="checkbox" name="opt_beer" value="Beer" ${has_beer}>Beer<br />
	<input type="checkbox" name="opt_livemusic" value="Live music" ${has_livemusic}>Live music<br />
	<input type="checkbox" name="opt_dancefloor" value="Dance floor" ${has_dancefloor}>Dance floor<br />
	<input type="checkbox" name="opt_nosmoking" value="No smoking" ${has_nosmoking}>No smoking<br />
    </td>
</tr>
<tr>
	<td colspan="2"><input value="Update entries!" type="submit" /><input type="hidden" name="id" value="${id}" /></td>
</tr>
</table>
</form>

<%
}
else {
	out.println("<h1>Session expired!</h1>");
	out.println("<a href='http://localhost:8080/Pub2SearchAdmin/login.jsp'>Go to login page</a>");
}
%>

</body>
</html>